import createVanilla from 'zustand/vanilla'
import { subscribeWithSelector } from 'zustand/middleware'
import create from 'zustand'
import { Mt } from '@/api/manager/mt'
import type { IMcc } from '@/api/manager/type'
type StateStore = {
	chairman: Mt | null
	speaker: IMcc | null
	/**是否开启/取消管理方选看画面合成 */
	isChairmanSelectView: boolean
}
type IStore = StateStore & {
	update: (d: Partial<StateStore>) => void
	reset: () => void
}
const initialState: StateStore = {
	chairman: null,
	speaker: null,
	isChairmanSelectView: false,
}
export const store = createVanilla<IStore>()(
	subscribeWithSelector((set, get) => ({
		...initialState,
		update: (d) => set({ ...d }),
		reset: () => set(initialState),
	}))
)
export const useManagerStore = create(store)
